﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using HotelSoft.HotelManagement_DTO;
using HotelSoft.HotelManagement_BUS;


namespace HotelSoft.HotelManagement_GUI
{
    public partial class frmReport_NhanVien : Form
    {
        NhanVienBUS busNhanVien = new NhanVienBUS();
        public frmReport_NhanVien()
        {
            InitializeComponent();
            ThamSo thamso = new ThamSo();
            Cbm_ChucVu.Items.Add(thamso.dsCacLoaiNhanVien[0].ToString());
            Cbm_ChucVu.Items.Add(thamso.dsCacLoaiNhanVien[1].ToString());
            Cbm_ChucVu.Items.Add(thamso.dsCacLoaiNhanVien[2].ToString());
            Cbm_ChucVu.Items.Add(thamso.dsCacLoaiNhanVien[3].ToString());
            Cbm_ChucVu.Items.Add(thamso.dsCacLoaiNhanVien[4].ToString());
            Cbm_ChucVu.Items.Add(thamso.dsCacLoaiNhanVien[5].ToString());
            Cbm_ChucVu.SelectedIndex = 0;
        }
        //public void LoadCombobox()
        //{
        //    List<NhanVienDTO> dsphong = NhanVienBUS.LayDSNhanVien();
        //    Cbm_ChucVu.DataSource = dsphong;
        //    Cbm_ChucVu.DisplayMember = "ChucVu";
        //    Cbm_ChucVu.ValueMember = "ChucVu";

        //}
        private void Viewphong_Load(object sender, EventArgs e)
        {
            //LoadCombobox();
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (Cbm_ChucVu.SelectedIndex >= 0)
            {
                //NhanVienDTO nhanvien = (NhanVienDTO)Cbm_ChucVu.Items[Cbm_ChucVu.SelectedIndex];
                DataTable dt = new DataTable();
                docNhanVien = new rptReport_NhanVien();
                string s = Application.StartupPath + "\\rptReport_NhanVien.rpt";
                docNhanVien.Load(s);

                //dt = busNhanVien.dataTablegetListNhanVien(nhanvien.CHUCVU);
                dt = busNhanVien.dataTablegetListNhanVien(Cbm_ChucVu.Text);
                docNhanVien.Database.Tables["command"].SetDataSource(dt);
                Viewphong.ReportSource = docNhanVien;
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmReport_NhanVien_Load(object sender, EventArgs e)
        {
            CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
            Thread.CurrentThread.CurrentCulture = culture;
        }
    }
}
